// 订单数据模型
const mongoose = require("mongoose");
const { Schema, model } = mongoose;

const orders = new Schema({
    goods:{type:[{type:Schema.Types.ObjectId, ref:'Goods'}]},
    price:{type:'Number'},
    code:{type:'String'},
    address:{type:'Object'},
    shop:{type:Schema.Types.ObjectId, ref:'Shops'},
    deliver:{type:Schema.Types.ObjectId, ref:'Users'},
    user:{type:Schema.Types.ObjectId, ref:'Users'},
    plan:{type:'Number',enum:[-1,0,1,2,3,4], default:0},  //-1退款  -未支付 1已支付 2已接单 3出货 4送达 5收货
},{
    timestamps:true
});

module.exports = model('Orders', orders)
